package com.qtx.report.controller;

import com.qtx.report.common.ResultObject;
import com.qtx.report.pojo.dto.SysRoleMenuDto;
import com.qtx.report.pojo.vo.SysRoleMenuVo;
import com.qtx.report.service.ISysRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 角色菜单关系表 前端控制器
 * </p>
 *
 * @author qtx
 * @since 2022-09-21
 */
@RestController
@RequestMapping("/report/sysRoleMenu")
public class SysRoleMenuController {
    @Autowired
    private ISysRoleMenuService service;

    @GetMapping("/getMenuByRole")
    public ResultObject<List<SysRoleMenuVo>> getMenuByRole() {
        return ResultObject.success(service.getMenuByRole());
    }

    @PostMapping("/renew")
    public ResultObject<Boolean> renew(@RequestBody SysRoleMenuDto dto) {
        return ResultObject.success(service.saveOrUpdateNew(dto));
    }
}
